﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<List<Entity.Category>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    主页
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <style type="text/css">
        .list li { float: left; width: auto; list-style-type: none; padding-right: 10px; width: 100px; }
        .clear { clear: both; }
    </style>
    <script type="text/javascript">
        $(function () {
            $(".list>li:lt(4)").attr("style", "background-color:#eee;font-weight:bold;font-size:14px");
        });

        function deleteItem(itemID) {
            art.dialog.confirm('你确认执行操作？', function () {
                $.ajax({
                    type: "POST",
                    dataType: "json",
                    url: "/Category/Delete",
                    data: { id: itemID },
                    success: function (data) {
                        art.dialog({
                            icon: "succeed",
                            content: "操作成功",
                            lock: true,
                            opacity: 0.50,
                            id: "subLoading",
                            time: 5,
                            init: function () { location.href = location.href; }
                        });

                    }
                });
            }, function () { });
        }
     </script>
    <ul class="list">
        <li>编号</li><li>名称</li><li>上级编号</li><li>操作</li><li class='clear'></li>
        <%foreach (var i in Model)
          {
              Writer.Write("<li>{0}</li><li>{1}</li><li>{2}</li><li>{3}|{4}</li><li class='clear'></li>", i.ID, i.Name, i.ParentID, Html.ActionLink("编辑", "Edit", new { id = i.ID }), Html.ActionLink("删除", "deleteItem(\"" + i.ID + "\")", Entity.CommonEnums.UserOperatorRole.DeleteEvent));
          } %>
    </ul>
    <div class="clear">
    </div>
    <%=Html.ActionLink("添加","Create") %>
    分类：
    <%=Html.SelectList_Category() %>
    <%Html.RenderAction("CategoryForSelectList", "CommonUC"); %>
</asp:Content>
